home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d12
/
cxl41.arc
/
CXLWIN.H
< prev
next >
Wrap
C/C++ Source or Header
|
1989-03-05
|
15KB
|
338 lines
/*
┌──────────────────────────────────────────────────────────────────────────┐
│ │
│ CXLWIN.H - CXL (c) 1987, 1988 by Mike Smedley. │
│ │
│ This header file contains function prototypes and definitions for │
│ windowing functions. │
│ │
└──────────────────────────────────────────────────────────────────────────┘
*/
#if defined(__TURBOC__) /* Turbo C */
#if __STDC__
#define _Cdecl
#else
#define _Cdecl cdecl
#endif
#define _Near
#elif defined(__ZTC__) /* Zortech C++ */
#define _Cdecl
#define _Near
#elif defined(M_I86) && !defined(__ZTC__) /* Microsoft C/QuickC */
#if !defined(NO_EXT_KEYS)
#define _Cdecl cdecl
#define _Near near
#else
#define _Cdecl
#define _Near
#endif
#elif defined(__POWERC__) /* Power C */
#define _Cdecl
#define _Near
#endif
/*------------------------------[ WINDOW type ]------------------------------*/
typedef int WINDOW;
/*---------------------------[ Function Prototypes ]-------------------------*/
int _Cdecl disktowin(char *fname);
void _Cdecl videoinit(void);
int _Cdecl wactiv(WINDOW whandle);
int _Cdecl wblocked(WINDOW whandle);
int _Cdecl wborder(int btype);
int _Cdecl wbox(int wsrow,int wscol,int werow,int wecol,int btype
,int attr);
int _Cdecl wcclear(int attr);
int _Cdecl wcenters(int wrow,int attr,char *str);
int _Cdecl wchgattr(int battr,int wattr);
int _Cdecl wclose(void);
int _Cdecl wcloseall(void);
int _Cdecl wclreol(void);
int _Cdecl wclreos(void);
WINDOW _Cdecl wcopy(int nsrow,int nscol);
int _Cdecl wdelline(int wrow,int direc);
int _Cdecl wdupc(int ch,int count);
char *_Cdecl werrmsg(void);
int _Cdecl wfill(int wsrow,int wscol,int werow,int wecol,int ch,int attr);
struct _wrec_t *_Cdecl wfindrec(WINDOW whandle);
int _Cdecl wgetc(void);
int _Cdecl wgetchf(char *valid,int defchar);
int _Cdecl wgets(char *str);
int _Cdecl wgetns(char *str,int max);
int _Cdecl wgotoxy(int wrow,int wcol);
WINDOW _Cdecl whandle(void);
int _Cdecl whide(void);
int _Cdecl whline(int wsrow,int wscol,int count,int btype);
int _Cdecl winpdef(int wrow,int wcol,char *str,char *format,int fconv,
int fattr,int update,int (*validate) (char *));
int _Cdecl winpread(void);
int _Cdecl winputsf(char *str,char *fmt);
int _Cdecl winsline(int wrow,int direc);
int _Cdecl wintodisk(int srow,int scol,int erow,int ecol,char *fname);
int _Cdecl wmenudef(int wrow,int wcol,int attr,char *str,int tagchar,
int tagattr,char *desc);
int _Cdecl wmenuget(int barattr,int taginit,int pulldown);
int _Cdecl wmessage(char *str,int border,int leftofs,int attr);
int _Cdecl wmove(int nsrow,int nscol);
WINDOW _Cdecl wopen(int srow,int scol,int erow,int ecol,int btype,int battr,
int wattr);
int _Cdecl wperror(char *message);
int _Cdecl wpgotoxy(int wrow,int wcol);
int _Cdecl wprintc(int wrow,int wcol,int attr,int ch);
int _Cdecl wprintf(const char *format,...);
int _Cdecl wprints(int wrow,int wcol,int attr,char *str);
int _Cdecl wputc(int ch);
int _Cdecl wputns(char *str,int width);
int _Cdecl wputs(char *str);
int _Cdecl wreadcur(int *wrow,int *wcol);
void _Cdecl wrestore(int *wbuf);
int _Cdecl wrjusts(int wrow,int wjcol,int attr,char *str);
int *_Cdecl wsave(int srow,int scol,int erow,int ecol);
int _Cdecl wsbounds(int wssrow,int wsscol,int wserow,int wsecol);
int _Cdecl wscanf(const char *format,...);
int _Cdecl wscroll(int count,int direc);
int _Cdecl wsseldef(char *str);
char *_Cdecl wsselget(int attr);
int _Cdecl wsize(int nerow,int necol);
int _Cdecl wtextattr(int attr);
int _Cdecl wtitle(char *str,int tpos,int tattr);
int _Cdecl wunhide(WINDOW whandle);
int _Cdecl wvline(int wsrow,int wscol,int count,int btype);
/*----------------------[ structure of window records ]----------------------*/
struct _wrec_t {
struct _wrec_t *prev; /* pointer to previous record */
struct _wrec_t *next; /* pointer to next record */
int *wbuf; /* address of window's buffer */
WINDOW whandle; /* window's handle */
unsigned char srow; /* start row of window */
unsigned char scol; /* start column of window */
unsigned char erow; /* end row of window */
unsigned char ecol; /* end column of window */
unsigned char btype; /* window's box type */
unsigned char wattr; /* window's initial text attribute */
unsigned char battr; /* atrribute of window's border */
unsigned char border; /* has border? 0 = no, 1 = yes */
unsigned char row; /* window's current cursor row */
unsigned char column; /* window's current cursor column */
unsigned char attr; /* window's current text attribute */
char *title; /* address of window's title string */
unsigned char tpos; /* position of window's title */
unsigned char tattr; /* attribute of window's title */
unsigned char ssrow; /* scroll start row */
unsigned char sscol; /* scroll start column */
unsigned char serow; /* scroll end row */
unsigned char secol; /* scroll end column */
};
/*-------------------[ variables used by window manager ]--------------------*/
/* pointer to current record */
extern struct _wrec_t *_Near _Cdecl _wrec;
extern int _Near _Cdecl _werrno; /* last window function error code */
extern int _Near _Cdecl _wtotal; /* total number of open windows */
extern WINDOW _Near _Cdecl _whandle; /* last assigned handle number */
extern int _Near _Cdecl _wesc; /* Escape checking flag */
/* pointer to highest hidden record */
extern struct _wrec_t *_Near _Cdecl _whrec;
/*-------------[ error codes returned from windowing functions ]-------------*/
#define W_NOERROR 0 /* no error */
#define W_ALLOCERR 1 /* memory allocation error */
#define W_NOTFOUND 2 /* window handle not found */
#define W_NOACTIVE 3 /* no active window */
#define W_INVCOORD 4 /* invalid coordinates */
#define W_ESCPRESS 5 /* Escape key was pressed */
#define W_INVFORMT 6 /* invalid format string */
#define W_NOINPDEF 7 /* no inputs defined */
#define W_STRLONG 8 /* string too long for window */
#define W_NOBARDEF 9 /* no bar menu records defined */
#define W_INVBTYPE 10 /* invalid box type */
#define W_INVTPOS 11 /* invalid title position */
#define W_NOBORDER 12 /* no window border */
#define W_NOSELDEF 13 /* no selection records defined */
#define W_LENFORMT 14 /* length of format string invalid */
#define W_NOHIDDEN 15 /* no hidden windows */
#define W_NOTHIDD 16 /* window is not hidden */
/*---------------[ direction codes for scrolling functions ]----------------*/
#define SDOWN 0 /* scroll down */
#define SUP 1 /* scroll up */
/*---------------------[ window input record definition ]--------------------*/
struct _winp_t {
struct _winp_t *prev; /* pointer to previous record */
struct _winp_t *next; /* pointer to next record */
unsigned char wrow; /* start of input - window row */
unsigned char wcol; /* start of input - window column */
char *str; /* address of receiving string */
char *buf; /* address of temp receive string */
char *format; /* input field format string */
char fconv; /* field conversion character */
unsigned char fattr; /* input field attribute */
int (*validate) (char *); /* addr. of validation function */
int lenbuf; /* length of buffer */
int lenfld; /* length of screen input field */
int lenfmt; /* length of format string */
};
/*-----------------[ variables used by window input functions ]--------------*/
/* pointer to highest record */
extern struct _winp_t *_Near _Cdecl _winp;
/*------------------[ window bar menu record definition ]--------------------*/
struct _wmenu_t {
struct _wmenu_t *prev; /* pointer to previous record */
struct _wmenu_t *next; /* pointer to next record */
unsigned char wrow; /* start of text opt - window row */
unsigned char wcol; /* start of text opt - window col */
unsigned char attr; /* attribute of text option */
char *str; /* string containing text option */
unsigned char tagchar; /* tag character */
unsigned char tagattr; /* attribute of tag character */
char *desc; /* text description of menu option */
};
/*-------------[ variables used by window bar menu functions ]---------------*/
/* pointer to highest record */
extern struct _wmenu_t *_Near _Cdecl _wmenu;
/*--------------[ pull-down menu definitions for wmenuget() ]----------------*/
#define PDMAIN 1 /* main menu of a pull-down system */
#define PDPREV 2 /* main menu, select prev pull-down */
#define PDNEXT 3 /* main menu, select next pull-down */
#define PDMENU 4 /* pull-down menu */
/*------------------[ window selection record definition ]-------------------*/
struct _wssel_t {
struct _wssel_t *prev; /* pointer to previous record */
struct _wssel_t *next; /* pointer to next record */
char *str; /* string used for selection */
};
/*------------[ window title position definitions for wtitle() ]-------------*/
#define TDELETE 0 /* delete title */
#define TLEFT 1 /* left justified */
#define TCENTER 2 /* centered */
#define TRIGHT 3 /* right justified */
/*------------------------[ definition of NULL ]-----------------------------*/
#if !defined(NULL)
#if defined(__TURBOC__) /* Turbo C */
#if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__)
#define NULL 0
#else
#define NULL 0L
#endif
#elif defined(__ZTC__) /* Zortech C++ */
#ifdef LPTR
#define NULL 0L
#else
#define NULL 0
#endif
#elif defined(M_I86) && !defined(__ZTC__) /* Microsoft C/QuickC */
#if defined(M_I86SM) || defined(M_I86MM)
#define NULL 0
#else
#define NULL 0L
#endif
#elif defined(__POWERC__) /* Power C */
#define NULL 0
#endif
#endif
/*-----------------------[ video RAM segment address ]-----------------------*/
extern unsigned _Near _Cdecl _videoseg;
/*--------------[ attribute codes for functions that use them ]--------------*/
/* attribute codes are created by ORing the codes for foreground
color, background color, and optionally blink, together. For
example, to create an attribute code for light blue on green,
you would use LBLUE|_GREEN and to make the foreground blink,
you would add |BLINK onto the end of that. */
#if !defined(BLACK) /* foreground colors */
#define BLACK 0
#define BLUE 1
#define GREEN 2
#define CYAN 3
#define RED 4
#define MAGENTA 5
#define BROWN 6
#define YELLOW 14
#define WHITE 15
#endif
#if !defined(LGREY)
#define LGREY 7 /* CXL abbreviates LIGHT as L */
#define DGREY 8 /* and DARK as D for ease of use */
#define LBLUE 9
#define LGREEN 10
#define LCYAN 11
#define LRED 12
#define LMAGENTA 13
#define _BLACK 0 /* background colors */
#define _BLUE 16
#define _GREEN 32
#define _CYAN 48
#define _RED 64
#define _MAGENTA 80
#define _BROWN 96
#define _LGREY 112
#endif
#if !defined(BLINK)
#define BLINK 128 /* blink attribute */
#endif
/*-----------------------[ Macro-Function Definitions ]----------------------*/
#if !defined(MK_FP)
#define MK_FP(seg,ofs) ((void far *) (((unsigned long)(seg) << 16) | \
(unsigned)(ofs)))
#endif
#if !defined(attrib)
#define attrib(f,b,i,bl) ((b<<4)|(f)|(i<<3)|(bl<<7))
#endif
#if !defined(clrwin)
#define clrwin(a,b,c,d) gotoxy_(a,b);fill(a,b,c,d,' ',(readchat()>>8))
#endif
#define wclear() wcclear(_wrec->wattr)
#define wisactiv(a) ((a==_wrec->whandle)?1:0)
#define wsetesc(a) _wesc=((a)?1:0)